It's impossible to get this right from outside resolve() But you can get it to do it for you, by using one of the overloads that takes an error_code& as an out-parameter.
It's impossible to get this right from outside resolve(). But you can get it to do it for you, by using one of the overloads that takes an error_code& as an out-parameter: iterator resolve(const query & q, boost::system::error_code & ec) iterator resolve(const endpoint_type & e, boost::system::error_code & ec) and then return the error_code it sets. I trust that this will wrap up errno or h_errno as appropriate.
You have to come up with error code and category in order to create error_code object. Here is an example, assuming that error is due to another host refusing connection: error_code ec (errc::connection_refused, system_category()); return ec; You can also pass errno value as error code when using system category. For example: #include #include #include void foo () { ifstream file ("test.
Txt"); if (!file. Is_open ()) { int err_code = errno; boost::system::error_code ec (err_code , boost::system::system_category ()); throw boost::system::system_error (ec, "cannot open file"); } } Unfortunately, this library is poorly documented, so I can recommend you to look into header files to figure things out. The code is fairly simple and straight forward there.
Just in case your compiler supports C++11 and you are willing to use it, this functionality made it into standard. As far as I know gcc 4.6.1 has it already. Here is a simple example: #include #include std::error_code SystemError::getLastError () { int err_code = errno; return std::error_code (err_code, std::system_category ()); } void foo () { throw std::system_error (getLastError (), "something went wrong"); } Generally, libraries pass error_code object around if there is no need to throw and use system_error to throw an exception describing system failures.
Another reason to use error_code without exceptions is when you need to signal the error across different threads. But C++11 has a solution for propagating exceptions across threads. Hope it helps!
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.